package Po;

public class Credits implements DataInterface{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public int credits;
	public double creditsToMoneyRate;
	public double moneyToCreditsRate;
	
	public double use(double p,int credits){
		if(credits <= this.credits){
			this.credits -= credits;
			return p - credits*creditsToMoneyRate;
		}
		return p;
	}
	
	public void addCredits(double p){
		if(p >= 0)
			this.credits += p*moneyToCreditsRate;
	}
}
